//
//  UIImage+FixImage.m
//  SelfDriving
//
//  Created by Kipp Dev on 2017/3/14.
//  Copyright © 2017年 apple. All rights reserved.
//

#import "UIImage+FixImage.h"

@implementation UIImage (FixImage)
+(UIImage *)fixOrientation:(UIImage *)image{
    if (image.imageOrientation == UIImageOrientationUp) {
        return image;
    }
    UIGraphicsBeginImageContextWithOptions(image.size, false, image.scale);
    CGRect rect = XYWH(0,0,image.size.width,image.size.height);
    [image drawInRect:rect];
    UIImage * normalizedImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return normalizedImage;
}
@end
